﻿using System;
using System.Collections;
using System.Collections.Generic;
#if UNITY_EDITOR
using UnityEditor;
#endif
using UnityEngine;

public class SCInstance : MonoBehaviour {

    public static bool isPaused = false;
    private static SCInstance instance;
    public static SCInstance Instance {
        get { return instance; }
    }
    public void Init()
    {
        if (instance != null) return;
        instance = this;
        IStreamCapture.Init();
#if UNITY_EDITOR
        //EditorApplication.playModeStateChanged += OnPlayModeStateChanged;
        EditorApplication.pauseStateChanged += OnPauseModeStateChanged;
#endif
    }
#if UNITY_EDITOR
    private void OnPauseModeStateChanged(PauseState state)
    {
        isPaused = state == PauseState.Paused ? true : false;
    }
#endif

    // Update is called once per frame
    void Update () {
        Dispatcher.WakeAll();
    }
    private void OnDestroy()
    {
        Dispatcher.WakeAll();
        IStreamCapture.Deinit();
    }
}
